package Month07.day28;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class DemoMap {
    public static void main(String[] args) {
        HashMap<String, Integer> map = new HashMap<>();
        map.put("age", 18);
        map.put("Score", 20);
        map.put("money", 20);
        map.put("money", 21);
        System.out.println(map);
        System.out.println("====================");
        map.remove("age");
        System.out.println(map);
        Integer money = map.get("money");
        System.out.println(money);
        boolean empty = map.isEmpty();
        System.out.println(empty);
        boolean a = map.containsKey("a");
        System.out.println(a);
        boolean b = map.containsValue(20);
        System.out.println(b);
        int size = map.size();
        System.out.println(size);
        map.replace("money",21,18);
        System.out.println(map);
//        map.clear();
//        System.out.println(map);
        Set<String> strings = map.keySet();
        for (String string : strings) {
            Integer integer = map.get(string);
            System.out.println(string+"========"+integer);
        }
        System.out.println("=================");
        Set<Map.Entry<String, Integer>> entries = map.entrySet();
        for (Map.Entry<String, Integer> entry : entries) {
            String key = entry.getKey();
            Integer value = entry.getValue();
            System.out.println(key+value);
        }
    }
}
